# 17.py
# 1. 小于和等于是不能合起来支持 小于或者等于的
# 1. 但是可以有方法可以实现, 装饰器就可以实现

import functools

@functools.total_ordering
class Person:
  def __lt__(self, other):
    print('lt')
    pass

  def __eq__(self, other):
    print('eq')
    pass

p1 = Person()
p2 = Person()


print(p1 < p2)
print(p1 > p2)
print(p1 <= p2)

print(Person.__dict__)

# 没有装饰器装饰前的内容：
# None
# None
# {'__module__': '__main__', '__lt__': <function Person.__lt__ at 0x00000193B655DE40>, '__eq__': <function Person.__eq__ at 0x00000193B654CAE0>, '__dict__': <attribute '__dict__' of 'Person' objects>, '__weakref__': <attribute '__weakref__' of 'Person' objects>, '__doc__': None, '__hash__': None}

# 有装饰器装饰后的内容：
# None
# True
# None
# {'__module__': '__main__', '__lt__': <function Person.__lt__ at 0x000002084335DE40>, '__eq__': <function Person.__eq__ at 0x000002084334CAE0>, '__dict__': <attribute '__dict__' of 'Person' objects>, '__weakref__': <attribute '__weakref__' of 'Person' objects>, '__doc__': None, '__hash__': None, '__gt__': <function _gt_from_lt at 0x00000208433BB1A0>, '__le__': <function _le_from_lt at 0x00000208433BB240>, '__ge__': <function _ge_from_lt at 0x00000208433BB2E0>}
